/*
 * @lc app=leetcode.cn id=392 lang=cpp
 *
 * [392] 判断子序列
 */

// @lc code=start
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
    bool isSubsequence(string s, string t) {
        int i = 0;
        for(int j = 0; i < s.length() && j < t.length(); i++, j++)
        {
            while(j < t.length() && t[j] != s[i]) j++;
            if(j == t.length()) break;
        }
        return i == s.size();
    }
};
// @lc code=end

